import request from '@/utils/request'

// 获取订单详情
export function getOrderDetail(orderId) {
  return request.get({
    url: `/user/order/detail/${orderId}`
  })
}

// 取消订单
export const cancelOrder = (orderId) => {
  return request.put({
    url: `/user/order/cancel/${orderId}`
  })
}

// 删除订单
export function deleteOrder(orderId) {
  return request.delete({
    url: `/order/delete/${orderId}`
  })
}

// 申请退款
export const applyRefund = (orderId, data) => {
  return request.get({
    url: `/user/order/refund/${orderId}`,
    data
  })
}

// 确认收货
export const completeOrder = (orderId) => {
  return request.put({
    url: `/user/order/complete/${orderId}`
  })
}


// 获取订单优惠价格
export function getOrderCouponPrice(data) {
  return request.post({
    url: '/user/order/select_coupon',
    data
  })
}

// 获取订单列表
export function getOrderList(params) {
  return request.get({
    url: '/user/order',
    data: params
  })
}

// 创建订单
export function createOrder(data) {
  return request.post({
    url: '/user/order/createOrder',
    data
  })
}

// 订单支付成功
export const orderPaySuccess = (orderId) => {
  return request.put({
    url: `/user/order/createOrderPaySuccess/${orderId}`
  })
}

// 提交评价
export function submitReviews(data) {
  return request.post({
    url: '/user/order/evaluate',
    data
  })
}

// 获取退款详情
export function getRefundDetail(id) {
  return request.get({
    url: `/user/order/refundDetail/${id}`
  })
}



